/**********************************************************

file:  atmega128_usart.h

Author:	  Albert

Notes: for 9600BD-> 0.85ms per byte,38400bd->0.21ms per byte @14.7456Mhz
 **********************************************************/
#ifndef F_CPU
#define F_CPU 14745600UL
#endif

#ifndef __ATMEGA128_USART_H__             
  #define __ATMEGA128_USART_H__            

  #include <avr/io.h>
  #include <avr/interrupt.h>

  #define MAX_BUFFER_SIZE 300 //mutilply of 8
  #define BAUDRATE_9600   9600
  #define BAUDRATE_38400   38400

  extern unsigned char usart_mode; // For USART mode, 0 -> polling 1->Interrupt
  extern unsigned char usart0_rec_buff[MAX_BUFFER_SIZE];
  extern unsigned char usart1_rec_buff[MAX_BUFFER_SIZE];
  extern volatile unsigned char usart0_count;
  extern volatile unsigned char usart1_count;


  void Data_process(unsigned char usart_no, unsigned char data);
  void USART_INIT(unsigned char usart_no, unsigned char usart_mode,unsigned int usart_speed);
  void USART_Transmit(unsigned char usart_no, unsigned char data);
  void USART_BYTES_Transmit(unsigned char usart_no, unsigned char data_array[], unsigned int size_of_array);
  void USART_Receive(unsigned char usart_no);

#endif 

 /*********************************************************/
